-- create xml_parser object
parser = pug.xml_parser( pug.xml_parser.parse_default, true, 4);

-- parse string
xml_string = '<xml><child>some data </child><child2 attr="value"/></xml>';
print('parsing string: ' .. xml_string );
parser:parse(xml_string, pug.xml_parser.parse_noset);
print( tostring(parser:document()) );

-- Testing xml_node
-- getting root
root=parser:document();

-- add a element child
child=root:append_child( pug.xml_node_type.element );
print( tostring(root) );

-- rename child to child
child:name('child');
print('child name is ' .. child:name() );
print( tostring(root) );

-- adding attributes
child:append_attribute('attribute','value');
child:append_attribute('attribute2','value2');

-- adding on children
child2=child:append_child( pug.xml_node_type.element );
child2:name('child2');
print( tostring(root) );






----local tm = require("transactionManager");
---- game background
--local sky = display.newImage( "images/menu/backgroundCity.png",true)
---- baseline
--local baseline = 300
--local speed = 0.4
---- a bunch of foliage
--local tree = {}
--tree[1] = display.newImage( "images/obstack.png" )
----tree[1].xScale = 0.7; tree[1].yScale = 0.7
--tree[1]:setReferencePoint( display.CenterReferencePoint )
--tree[1].contentWidth = 34;
--tree[1].contentHeight = 34;
--tree[1].x = 20; 
--tree[1].y = baseline-85
--tree[1].dx = speed
--tree[2] = display.newImage( "images/obstack.png" )
----tree[2].xScale = 0.6; tree[2].yScale = 0.6
--tree[2]:setReferencePoint( display.CenterReferencePoint )
--tree[2].contentWidth = 34;
--tree[2].contentHeight = 34;
--tree[2].x = 200; 
--tree[2].y = baseline-125
--tree[2].dx = speed
--
---- Add body tree
--for i = 1, #tree, 1 do
--    tree[i].tag = "obstack";
--    physics.addBody( tree[i], "static", { density = 1.0, friction = 0.5, bounce = 0.2 } )
--end
------------------------------------------------------------------------------------
---- 
----      NOTE:
----      
----      Code outside of listener functions (below) will only be executed once,
----      unless storyboard.removeScene() is called.
---- 
-----------------------------------------------------------------------------------
--
--
---- local forward references should go here --
--
--local grass = display.newRect(0, 0, 2*display.contentWidth, 14 )
--grass:setFillColor(0, 0, 0)
----grass:setStrokeColor(180, 180, 180)
----grass.width = display.contentWidth;
----grass.height = 20 
--grass.x = 0
--grass.y = baseline - 70
--
----local grass2 = display.newImage( "images/way1.png" )
----grass2:setReferencePoint( display.CenterLeftReferencePoint )
----grass2.width = display.contentWidth + 250
----grass2.height = 20
----grass2.x = 730
----grass2.y = baseline - 70;
--
--grass.tag="way";grass2.tag="way";
--physics.addBody( grass, "static", { density = 1.0, friction = 0.5, bounce = 0.2 } )
--physics.addBody( grass2, "static", { density = 1.0, friction = 0.5, bounce = 0.2 } )
